package com.itheima.bean;

import java.util.List;

public class PageBean<T> {

	List<T> list;   //页面展示的内容 select * from product limit (pageNumber-1)*pageSize ,pageSize
	private int pageSize;  //每页显示的条数    自己规定
	private int pageNumber;  //当前页            从前台传递过去
	private int pageCount;   //总条数 select count(*) from product 
	private int pageTotle;   //总页数     (int)Math.ceil(pageCount*1.0/pageSize)
	public List<T> getList() {
		return list;
	}
	public void setList(List<T> list) {
		this.list = list;
	}
	public int getPageSize() {
		return pageSize;
	}
	public void setPageSize(int pageSize) {
		this.pageSize = pageSize;
	}
	public int getPageNumber() {
		return pageNumber;
	}
	public void setPageNumber(int pageNumber) {
		this.pageNumber = pageNumber;
	}
	public int getPageCount() {
		return pageCount;
	}
	public void setPageCount(int pageCount) {
		this.pageCount = pageCount;
	}
	
	public void setPageTotle(int pageTotle) {
		this.pageTotle = pageTotle;
	}
	
	//获取总页数
	public int getPageTotle() {
		return (int)Math.ceil(pageCount*1.0/pageSize);
	}
	
	//获取数据索引
	public int getIndex(){
		return (pageNumber-1)*pageSize;
	}
	
	//定义构造
	public PageBean(int pageSize, int pageNumber) {
		super();
		this.pageSize = pageSize;
		this.pageNumber = pageNumber;
	}
	
	
}
